<?php
/**
 * Project: Espolon
 * Licence: BSD License
 * Link: http://espolon.org/
 * Copyright: Nicolas de Bari Embriz Garcia Rojas <nbari at pobox dot com>
 * Author: Nicolas de Bari Embriz Garcia Rojas <nbari at pobox dot com>
 * Version: Beta
 */

if (!defined('SITE_ROOT')) exit('No direct script access allowed');

/**
 * only admin
 */
#$this->is_admin();

/**
 * Autoload classes
 */
function __autoload($class_name) {
  require_once 'class.'.strtolower($class_name).'.php';
}

$command = isset($_SESSION['uid']) ? $command : (in_array($command, array('signin', 'recover_password')) ? $command : 'signin');

switch ($command) {
  case 'accesscontrol':
		$tpl->assign('accesscontrol', true);
		$command_tpl = 'accesscontrol.tpl';
		require_once 'accesscontrol.php';
	break;
	case 'modules':
		$tpl->assign('modules', true);
		$command_tpl = 'modules.tpl';
	  require_once 'modules.php';
	break;
	case 'config':
	  $tpl->assign('configuration', true);
	  $command_tpl = 'configuration.tpl';
	  require_once 'configuration.php';
	break;
	case 'recover_password':
		$tpl->assign('tab2', true);
		$command_tpl = ($options[0] == 'code') ? 'changepassword.tpl' : 'password.tpl';
		require_once 'recover_password.php';
	break;
	case 'signin':
		$tpl->assign('tab1', true);
		$command_tpl = 'signin.tpl';
	  require_once 'signin.php';
	break;
	default:
		$command_tpl = 'null.tpl';
		$tpl->assign('path',"$module");
	break;
}

$tpl->assign('command_tpl',"$template/modules/$module/$command_tpl"); // display command.tpl
$tpl->assign('module_tpl', "modules/$module/$module_tpl"); // display admin.tpl
$tpl->display("$template/base.tpl");

?>